﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Abp.Domain.Repositories;
using Abp.Domain.Services;
using Abp.UI;
using FwProject.Core.AppVersion;
using FwProject.ShoppingMall.Com;
using FwProject.ShoppingMall.EventAdvertising;

namespace FwProject.Manager
{
    public class ShopOrderManager : IDomainService
    {
        private readonly IRepository<ShopOrder, Guid> _shopOrderRepository;
        private readonly IRepository<ShopCar, Guid> _shopCarRepository;

        public ShopOrderManager(IRepository<ShopOrder, Guid> shopOrderRepository,
            IRepository<ShopCar, Guid> shopCarRepository)
        {
            _shopOrderRepository = shopOrderRepository;
            _shopCarRepository = shopCarRepository;
        }
        /// <summary>
        /// 添加一个购物车数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task<Guid> CreateShopOrder(ShopOrder model)
        {
          
            return await _shopOrderRepository.InsertAndGetIdAsync(model);
           
        }
        /// <summary>
        /// 修改一个购物车
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>

        public async Task UpdateShopOrder(ShopOrder model)
        {
            await _shopOrderRepository.UpdateAsync(model);
        }

        /// <summary>
        /// 删除一个购物车数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task DeleteShopOrder(ShopOrder model)
        {
            await _shopOrderRepository.DeleteAsync(model);
        }
    }
}
